package com.ctrlcar.giftrecord.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * 用户关系实体类
 * 
 * @TableName relative
 */
@TableName(value ="relative")
@Data
public class Relative implements Serializable {
    /**
     * 亲朋ID
     */
    @TableId(type = IdType.AUTO)
    private Integer relativeId;

    /**
     * 用户ID
     */
    private Integer userId;

    /**
     * 关系人姓名
     */
    private String name;

    /**
     * 关系人头像
     */
    private String avatar;

    /**
     * 关系人地址
     */
    private String address;

    /**
     * 备注信息
     */
    private String remark;
    /**
     * 亲朋手机号
     */
    private String relativePhone;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 删除标志，0表示未删除，1表示已删除
     */
    private Integer isDelete;

    /**
     * 序列化ID，用于版本控制
     */
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * 重写equals方法，比较两个Relative对象是否相等
     * 
     * @param that 另一个对象
     * @return 如果两个对象相等返回true，否则返回false
     */
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Relative other = (Relative) that;
        return (this.getRelativeId() == null ? other.getRelativeId() == null : this.getRelativeId().equals(other.getRelativeId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
            && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
                && (this.getRelativePhone() == null ? other.getRelativePhone() == null : this.getRelativePhone().equals(other.getRelativePhone()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    /**
     * 重写hashCode方法，生成该对象的哈希码
     * 
     * @return 该对象的哈希码
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRelativeId() == null) ? 0 : getRelativeId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getRelativePhone() == null) ? 0 : getRelativePhone().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    /**
     * 重写toString方法，以字符串形式输出对象信息
     * 
     * @return 包含对象信息的字符串
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", relativeId=").append(relativeId);
        sb.append(", userId=").append(userId);
        sb.append(", name=").append(name);
        sb.append(", avatar=").append(avatar);
        sb.append(", address=").append(address);
        sb.append(", remark=").append(remark);
        sb.append(", relativePhone=").append(relativePhone);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
